import { Entity, Column, ManyToOne, JoinColumn } from 'typeorm'
import { BaseEntity } from './Base'
import { User } from './User'

@Entity('license_records')
export class LicenseRecord extends BaseEntity {
    @Column({
        length: 50,
        comment: '车牌号码'
    })
    license: string

    @Column({
        type: 'time',
        comment: '记录时间（时分）'
    })
    time: string

    @Column({
        length: 20,
        comment: '手机号码'
    })
    phoneNumber: string

    @ManyToOne(() => User, (user) => user.licenseRecords)
    @JoinColumn({ referencedColumnName: 'openid' })
    user: User

    @Column({
        comment: '关联的用户 openid'
    })
    openid: string
}
